package blackberry.util.hotkey;

public class DjProgramaticFilter{
	
	private static final int APPOINTED_TIME_PROGRAMATIC = 15;
	private int beforeTime;

	public synchronized boolean isProgramatic(int time, int appointedTime) {
		try{
			return isOnTime(time, appointedTime);
		} finally {
			beforeTime = time;
		}
	}
	
	public synchronized boolean isProgramatic(int time) {
		return isProgramatic(time, APPOINTED_TIME_PROGRAMATIC);
	}
	
	private boolean isOnTime(int time, int appointedTime) {
		return (time - beforeTime) < appointedTime ? true : false;
	}
}